import 'package:flutter/cupertino.dart';
import 'package:flutter_base_app/utils/user/user_help.dart';

/// 全局配置
class AppGlobal {
  static double width = 0; //屏幕宽度
  static double height = 0; //屏幕高度
  static late BuildContext context;

  // static String httpProxy = '192.168.1.6:8888';
  // static String httpProxy = '127.0.0.1:8888';
  static String channel = '';

  get isLogin => UserHelp.isLogin; //是否登录

  //全局的GlobalKey
  static final GlobalKey globalKey = GlobalKey();

  /// 获取屏幕尺寸等信息
  static Future<void> init(ctx) async {
    context = ctx;
    Future.microtask(() {
      final width = MediaQuery.of(context).size.width;
      final height = MediaQuery.of(context).size.height;
      AppGlobal.width = width;
      AppGlobal.height = height;
    });
  }
}
